/*
 * ILinkBaseAction.java
 * 
 * Version Information
 * Date Mar 20, 2006
 *
 * Copyright (c) AmSoft Systems, 2006
 */

package net.amsoft.iservice.ilink.hibernate;

import java.util.Date;
import net.amsoft.iservice.ilink.util.ILinkConstants;
import net.amsoft.iservice.util.exception.IServiceException;

public class ILinkBaseClass {
	protected Long id;

	protected Date creationTime;

	protected Date modificationTime;

	protected short state;

	public ILinkBaseClass(short state) {
		this.state = state;
	}

	public ILinkBaseClass() {
	}

	public Long getId() {
		return id;
	}

	private void setId(Long id) {
		this.id = id;
	}

	public Date getCreationTime() {
		return this.creationTime;
	}

	protected void setCreationTime(Date creationTime) {
		this.creationTime = creationTime;
	}

	public Date getModificationTime() {
		return this.modificationTime;
	}

	protected void setModificationTime(Date modificationTime) {
		this.modificationTime = modificationTime;
	}

	public short getState() {
		return state;
	}

	public void setState(short state) {
		this.state = state;
	}

	public ILinkBaseClass insert() throws IServiceException {
		this.setCreationTime(new Date());
		this.setModificationTime(new Date());
		this.setState(state);
		return (this);
	}

	public ILinkBaseClass update() {
		this.setModificationTime(new Date());
		return (this);
	}

	public ILinkBaseClass remove() {
		this.setState((short) ILinkConstants.STATE_INACTIVE);
		return (this);
	}
}